//
//  OosCategory.m
//  Oos4ios
//
//  Created by Pablo Gonzalez on 3/24/11.
//  Copyright 2011 11870.com. All rights reserved.
//


#import <oos4ios/Model/OosCategory.h>

@implementation OosCategory

@dynamic label;
@dynamic term;

@dynamic services;

static NSString *fetchPredicate = @"term = %@";

+ (OosCategory *) categoryFromTerm:(NSString *)term
{
    
    OosCategory *result = [super objectWithPredicate:fetchPredicate, term];
    
    if (!result) {
        result = [super create];
        result.term = term;
    }
    return result;
    
//	NSSet *objects = [super objectsWithPredicate: @"term = %@", term];
//	if ([objects count] > 0) {
//		return [objects anyObject];
//	} else {
//		OosCategory *category = [super create];
//		category.term = term;
//		return category;
//	}
}

//- (NSString *) description
//{
//    return self.label;
//}


@end
